<template>
		<view>
			<view class="user" @click="jumpTo(item.user_id)" v-for="item in firend" key="user_id">
				<image :src="item.picture" style="width: 120rpx; height: 120rpx; margin-left: 30rpx; margin-right: 10rpx;"></image>
				<view class="tex">
					<view class="text-container">  
					    <text>{{item.user_name}}</text> <!-- 在这里下移文本 -->  
					</view>  
				</view>
			</view>
		</view>
</template>

<script lang="ts" setup>
	import {onLoad,onShow} from '@dcloudio/uni-app'
	import { ref } from 'vue';
	
	interface Firend{
		user_id:number,
		user_name:string,
		picture:string
	}
	let firend = ref<Firend[]>();
	
	
	const jumpTo =(id:number)=>{

		uni.navigateTo({  
		    url: '/pages/person/home_page?id='+id
		});  

	}
	
	onShow(()=>{
		uni.request({
		    url: 'http://121.40.242.216:8081/api/friend/list',
			method:'GET',
		    data: {
		    },
		    header: {
				'satoken':uni.getStorageSync("satoken"),
				'loginId':uni.getStorageSync("loginId")
		    },
		    success: (res) => {
		        console.log(res.data);
				firend.value=res.data!.data
		    }
		});
	})
</script>

<style>  
    .user {
		display: flex;
		justify-content: flex-start;
		align-items: flex-start;
		margin-top: 20rpx;
    }
	.text-container {  
	        margin-top: 10rpx; /* 下移文本 */  
	    } 
	.tex{
		height: 120rpx;
		width: 600rpx;
		border-bottom-style: solid;
		border-bottom-width: 1rpx;
		border-bottom-color: rgb(199.5, 201, 204);
	}
	
</style> 